import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const mcpTokenView = await client.devboxes.createMcpToken('id', {
mcp_config: 'mcp_config',
secret: 'secret',
});
console.log(mcpTokenView.devbox_id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
mcp_token_view = client.devboxes.create_mcp_token(
id="id",
mcp_config="mcp_config",
secret="secret",
)
print(mcp_token_view.devbox_id)curl --request POST \
--url https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mcp_config": "<string>",
"secret": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mcp_config' => '<string>',
'secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token"
payload := strings.NewReader("{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"devbox_id": "<string>",
"mcp_config_id": "<string>",
"token": "<string>",
"url": "<string>",
"endpoint": "<string>",
"allowed_tools": [
"<string>"
]
}[Beta] Mint an MCP token for a Devbox.
[Beta] Mint a token that lets a running Devbox reach an upstream MCP (Model Context Protocol) server through the Runloop MCP hub, using the credential in the supplied secret. Tool access is limited to the MCP config’s allowed_tools, and the credential itself is never exposed to the Devbox.
The token is bound to this Devbox and is only accepted for requests that originate from it. Nothing is stored on the Devbox: the token is returned to the caller and is not re-issued when the Devbox is resumed.
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const mcpTokenView = await client.devboxes.createMcpToken('id', {
mcp_config: 'mcp_config',
secret: 'secret',
});
console.log(mcpTokenView.devbox_id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
mcp_token_view = client.devboxes.create_mcp_token(
id="id",
mcp_config="mcp_config",
secret="secret",
)
print(mcp_token_view.devbox_id)curl --request POST \
--url https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mcp_config": "<string>",
"secret": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mcp_config' => '<string>',
'secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token"
payload := strings.NewReader("{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/devboxes/{id}/create_mcp_token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mcp_config\": \"<string>\",\n \"secret\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"devbox_id": "<string>",
"mcp_config_id": "<string>",
"token": "<string>",
"url": "<string>",
"endpoint": "<string>",
"allowed_tools": [
"<string>"
]
}Authorizations
Body
[Beta] Parameters for minting an MCP token for a Devbox. The token grants the Devbox access to the upstream MCP server described by the MCP config, using the supplied credential, with tool-level access control based on the config's allowed_tools.
Response
MCP token minted successfully.
Was this page helpful?
